<!doctype html>
<html class="no-js">

	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="description" content="美丽说-wap首页,H5,H5首页">
		<meta name="keywords" content="美丽说,穿搭,女装,搭配">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>美丽说</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="Cache-Control" content="no-siteapp" />
		<link rel="icon" type="image/png" href="assets/i/mfavicon.png">
		<link rel="stylesheet" type="text/css" href="assets/css/reset.css" />
		<link rel="stylesheet" type="text/css" href="font-awesome-4.7.0/css/font-awesome.min.css" />
		<link rel="stylesheet" href="assets/css/amazeui.min.css">
		<link rel="stylesheet" href="assets/css/swiper.min.css">
		<link rel="stylesheet" href="assets/css/details.css">
	</head>
	<body>
		<div class="am-container cons">
			<div class="navs">
				<div class="return am-fl">
					<i class="am-inline-block"></i>
				</div>
				<div class="centers">
					<a href="personal.html">商品详情</a>
				</div>
			</div>
			<div class="primary-swiper">
				<div class="swiper-container swiper-container-horizontal banner">
					<div class="swiper-wrapper" id="slideImgs">
						
					</div>
					<div class="swiper-pagination swiper-pagination-fraction">
						
					</div>
				</div>
			</div>
			<div class="primary-info">
				<div class="services-container">
					<div class="info-services" id="J_Services">
						<div class="flex service-list"> 
							<span class="service-item"> 
								<img class="service-icon" src="assets/img/c24.png"> 
								<span class="service-name">退货补运费</span> 
							</span> 
							<span class="service-item"> 
								<img class="service-icon" src="assets/img/c24.png"> 
								<span class="service-name">全国包邮</span> 
							</span> 
							<span class="service-item"> 
								<img class="service-icon" src="assets/img/c24.png"> 
								<span class="service-name">7天无理由退货</span> 
							</span> 
							<span class="service-item"> 
								<img class="service-icon" src="assets/img/c24.png"> 
								<span class="service-name">72小时发货</span> 
							</span>
						</div> 
						<img class="service-arrow" src="assets/img/c1.png" alt="">
					</div>
				</div>
			</div>
			<div class="detail-wrap detail-shop">
				<div class="shop-top"></div>
				<div class="shop-info">
					<div class="clearfix" id="collect">
						
					</div>
					<div class="info-content">
						<div class="count">
							<div class="sale">
								<span class="fz-18">32.3万</span>
								<br>总销量
							</div>
							<div class="all">
								<span class="fz-18">283</span>
								<br>全部宝贝
							</div>
						</div>
						<div class="shop-evaluate">
							<ul>
								<li> <span>描述相符</span> 
									<em class="low">4.53</em> 
									<i class="low">低</i> 
								</li>
								<li> <span>价格合理</span> 
									<em>5</em> 
									<i>高</i> 
								</li>
								<li> 
									<span>质量满意</span> 
									<em class="low">4.51</em> 
									<i class="low">低</i> 
								</li>
							</ul>
						</div>
					</div>
					<div class="info-goshop">
						<a href="">进店逛逛</a>
					</div>
				</div>
			</div>
			<nav class="scrollspy-nav" data-am-scrollspynav="{offsetTop: 44}" data-am-sticky>
				<ul>
					<li>
						<a href="#details">图文详情</a>
						<i></i>
					</li>
					<li>
						<a href="#parameter">商品参数</a>
						<i></i>
					</li>
					<li>
						<a href="#comment">评价(73)</a>
						<i></i>
					</li>
					<li>
						<a href="#recommend">热卖推荐</a>
						<i></i>
					</li>
				</ul>
			</nav>
			<div class="am-panel am-panel-default secx" id="details">
				<div class="am-panel-bd am-cf sect sect-on">
					<div class="pics">
						<dl class="pic-box"> 
							<dt class="pic-title">穿着效果</dt> 
							<dt class="pic-desc">搭配完全不用花心思~轻松打造多变的你小心机的基础百搭款，不要错过哟！~</dt>
							<dd class="pic-list">
								
							</dd>
						</dl>
					</div>
					<div class="parameter-top"></div>
				</div>	
			</div>
			<div class="am-panel am-panel-default secx" id="parameter">
				<div class="am-panel-bd detail-parameter">
					<div class="parameter-head plr30"> 
						<span class="title">商品参数</span> 
					</div>
					<div class="parameter-wrap">
						<div class="size-list">
							<div class="item">
								<table>
									<tbody>
										<tr>
											<td>尺码</td>
											<td>S</td>
											<td>M</td>
											<td>L</td>
											<td>XL</td>
										</tr>
										<tr>
											<td>胸围</td>
											<td>92</td>
											<td>96</td>
											<td>100</td>
											<td>104</td>
										</tr>
										<tr>
											<td>袖长</td>
											<td>48</td>
											<td>49</td>
											<td>50</td>
											<td>51</td>
										</tr>
										<tr>
											<td>肩宽</td>
											<td>51</td>
											<td>52</td>
											<td>53</td>
											<td>54</td>
										</tr>
										<tr>
											<td>衣长</td>
											<td>62</td>
											<td>63</td>
											<td>64</td>
											<td>65</td>
										</tr>
									</tbody>
								</table>
							</div>
							<div class="item">
								<table>
									<tbody>
										<tr>
											<td>尺码</td>
											<td>XXL</td>
										</tr>
										<tr>
											<td>胸围</td>
											<td>108</td>
										</tr>
										<tr>
											<td>袖长</td>
											<td>52</td>
										</tr>
										<tr>
											<td>肩宽</td>
											<td>55</td>
										</tr>
										<tr>
											<td>衣长</td>
											<td>66</td>
										</tr>
									</tbody>
								</table>
							</div>
						</div>
						<div class="param-list">
							<ul>
								<li> <span class="param-name">图案</span>
									<p class="param-info">纯色</p>
								</li>
								<li> <span class="param-name">颜色</span>
									<p class="param-info">白色</p>
								</li>
								<li> <span class="param-name">袖型</span>
									<p class="param-info">灯笼袖</p>
								</li>
								<li> <span class="param-name">上衣厚度</span>
									<p class="param-info">适中</p>
								</li>
								<li> <span class="param-name">衣门襟</span>
									<p class="param-info">单排扣</p>
								</li>
								<li> <span class="param-name">穿着方式</span>
									<p class="param-info">开襟</p>
								</li>
								<li> <span class="param-name">尺码</span>
									<p class="param-info">S,XL,L,M,XXL</p>
								</li>
								<li> <span class="param-name">衣长</span>
									<p class="param-info">常规款（51-65cm）</p>
								</li>
								<li> <span class="param-name">版型</span>
									<p class="param-info">宽松</p>
								</li>
								<li> <span class="param-name">季节</span>
									<p class="param-info">春季</p>
								</li>
								<li> <span class="param-name">材质</span>
									<p class="param-info">棉</p>
								</li>
								<li> <span class="param-name">领型</span>
									<p class="param-info">荷叶领</p>
								</li>
								<li> <span class="param-name">袖长</span>
									<p class="param-info">长袖</p>
								</li>
								<li> <span class="param-name">风格</span>
									<p class="param-info">小清新</p>
								</li>
								<li> <span class="param-name">潮流</span>
									<p class="param-info">韩系</p>
								</li>
							</ul>
						</div>
					</div>
				<div class="rates-top"></div>
				</div>
			</div>	
			<div class="am-panel am-panel-default comment secx" id="comment">
				<div class="am-panel-bd panel-item comments">
					<div class="rates-head plr30">
						<a class="title" href="">购买评价 
							<span class="more">更多<i class="arrow"></i></span>
						</a>
					</div>
					<div class="rates-list plr30">
						<div class="rate-item">
							<div class="rate-user"></div>
							<div class="rate-cont">我可以说好喜欢吗？真的超好看，跟图片一样，物流我赞，物美价廉，朋友还夸我呢，好评！！！姐妹们放心购买吧，嘻嘻。</div>
							<div class="rate-attr">
								<span class="time">2018-03-29</span>
								<span class="sku">颜色:白色 尺码:XL </span>
							</div>
						</div>
					</div>
					<div class="recommend-top"></div>
				</div>
			</div>	
			<div class="am-panel am-panel-default recommend secx" id="recommend">
				<div class="am-panel-bd panel-item recom">
					<div class="recommend-head plr30"> 
						<span class="title">热卖推荐</span> 
					</div>
					<div class="ad-commodity">
						<div class="ad-box ad-box1">
							<ul class="am-avg-sm-2 am-thumbnails ad-box1">
								<li class="ad-lf">
									<a href="javascript:void(0);">
										<div class="img-box">
											<img src="assets/img/img058.JPG" />
										</div>
										<p class="title">【50元两件】学生白色t恤女短袖夏季韩版大码女装破洞个性字母印花体恤衫宽松t恤上衣女小清新 </p>
										<div class="goods-info">
											<span class="price">29.90</span>
										</div>
									</a>
								</li>
								<li class="ad-lr">
									<a href="javascript:void(0);">
										<div class="img-box">
											<img src="assets/img/img205.JPG" />
										</div>
										<p class="title">【两件50元】春装新款韩版潮牌BF港风卡通印花宽松短袖T恤女上衣情侣装闺蜜装男女打底t恤衫 </p>
										<div class="goods-info">
											<span class="price">28.50</span>
										</div>
									</a>
								</li>
							</ul>
							<ul class="am-avg-sm-2 am-thumbnails ad-box1">
								<li class="ad-lf">
									<a href="javascript:void(0);">
										<div class="img-box">
											<img src="assets/img/img221.JPG" />
										</div>
										<p class="title"> 夏季新款韩版宽松学生百搭纯棉字母印花小清新黄色短袖T恤女 </p>
										<div class="goods-info">
											<span class="price">39.90</span>
										</div>
									</a>
								</li>
								<li class="ad-lr">
									<a href="javascript:void(0);">
										<div class="img-box">
											<img src="assets/img/img022.JPG" />
										</div>
										<p class="title"> 2018春夏新款小清新oversize纯色系小口袋宽松版中长款五分袖t恤 </p>
										<div class="goods-info">
											<span class="price">55.30</span>
										</div>
									</a>
								</li>
							</ul>
							<ul class="am-avg-sm-2 am-thumbnails ad-box1 last-commodity">
								<li class="ad-lf">
									<a href="javascript:void(0);">
										<div class="img-box">
											<img src="assets/img/img145.JPG" />
										</div>
										<p class="title">【两件50元】韩范印花t恤女短袖夏装韩版修身显瘦闺蜜短袖字母t恤女潮学生软妹百搭打底衫上衣 </p>
										<div class="goods-info">
											<span class="price">29.90</span>
										</div>
									</a>
								</li>
								<li class="ad-lr">
									<a href="javascript:void(0);">
										<div class="img-box">
											<img src="assets/img/img107.JPG" />
										</div>
										<p class="title">【2件59元 多款可选】【新品特惠】夏装新款纯棉t恤女高品质短袖白色圆领宽松学生半袖上衣女 </p>
										<div class="goods-info">
											<span class="price">39.00</span>
										</div>
									</a>
								</li>
							</ul>
						</div>
					</div>
				</div>
			</div>	
			<div class="am-g footer">
				<div class="am-u-sm-6 footer-icon">
					<div class="am-u-sm-2 footer-im">
						<i class="icon"></i>
						<span class="text">客服</span>
					</div>
					<div class="am-u-sm-2 footer-shop">
						<i class="icon"></i>
						<span class="text">店铺</span>
					</div>
					<div class="am-u-sm-2 footer-fav" id="foot_fav">
						<i class="icon"></i>
						<span class="text">收藏</span>
					</div>
				</div>	
				<div class="am-u-sm-6 footer-buy">
					<span class="buy-cart">加入购物车</span> 
					<span class="buy-now">购买</span> 
				</div>
			</div>
			<div class="fix-btn" id="fix-btn">
				<a href="" class="cart"> 
					<i class="cart-num" id="cart-num">1</i> 
				</a>
				<p class="gotop"></p>
			</div>
			<div class="goods-sku">
				<div class="content">
					<div class="sku-title">
							
						
					</div>
					<div class="scroll">
						<div class="sku-list">
							<dl class="style"> <dt>颜色：</dt>
								<dd>
									<ol class="style-list">
										<li class="c" title="白色"> 白色</li>
									</ol>
								</dd>
							</dl>
							<dl class="size"> <dt>尺码：</dt>
								<dd>
									<ol class="size-list">
										<li class="" title="S"> S</li>
										<li class="" title="M"> M</li>
										<li class="" title="L"> L</li>
										<li class="" title="XL"> XL</li>
										<li class="" title="XXL"> XXL</li>
									</ol>
								</dd>
							</dl>
						</div>
						<div class="sku-num">
							<p class="title">数量:</p>
							<div>
								<div class="sku-counter"> 
									<span class="num-reduce num-disable"> 
										<b class="reduce-icon">－</b> 
									</span>
									<form id="goodsQuantity" class="goodsQuantity am-inline-block">
										<input type="hidden" name="_id" id="mid" value="" />
										<input type="hidden" name="sales" id="sales" value="" />
										<input type="hidden" name="total" id="total" value="" />
										<em class="num-input">1</em>
									</form>
									<span class="num-add"> 
										<b class="add-icon">＋</b>  
									</span>
								</div>
							</div>
						</div>
					</div>
					<div class="action"> 
						<span class="confirm">确定</span> 
					</div>
				</div>
			</div>	
			<div class="cons-bg"></div>
		</div>
		<div id="M_Tips" class="ui-tips">
			<span class="ui-tips-text">收藏成功</span>
		</div>
		<script src="assets/js/jquery-1.12.4.min.js"></script>
		<script src="assets/js/amazeui.min.js"></script>
		<script src="assets/js/swiper.min.js"></script>
		<script src="assets/js/details.js"></script>
		<script src="assets/js/template-web.js" type="text/javascript"></script>
		<script type="text/html" id="tmpl-slideImgs">
			{{each data.slideImgs}}
				<div class="swiper-slide img-box">
					<a href="javascript:void(0);">
						<img src="{{$value}}" />
					</a>
				</div>
			{{/each}}
		</script>
		<script type="text/html" id="tmlp-details">
			<div class="info-title break"> 
				<span>{{name}}</span> 
			</div>
			<div class="info-price flex"> 
				<span class="flex">   
					<span class="now">¥</span>
					<span class="now" id="unit_price">{{price}}</span> 
					<span class="market">¥{{marketPrice}}</span> 
					<span class="discount">活动价</span>
				</span>
			</div>
			<div class="info-other"> 
				<span class="item">库存{{inventory}}</span> 
				<span class="item">收藏669人</span>
				<span class="item">72小时发货</span> 
			</div>
		</script>
		<script type="text/html" id="store_info">
			<a class="info-avatar" href=""> 
				<img src="{{mdImg}}"> 
			</a>
			<div class="flex shop-info-container">
				<div class="shop-info-title">
					<p class="title">{{brand}}</p>
				</div>
				<div class="shop-collect"> 
					<span class="has-marked">已收藏</span> 
					<span class="not-marked"> 
						<span class="plus">+</span> 收藏 
					</span>
				</div>
			</div>
		</script>
		<script type="text/html" id="detailsImgs">
			{{@detail}}
		</script>
		<script type="text/html" id="buy_info">
			<div class="sku-title-img">
				<img src="{{mdImg}}" alt=""/> 
			</div>
			<div class="sku-title-desc"> 
				<span class="sku-title-text">{{name}}</span> 
				<span class="sku-title-price"> 
					<span class="price">¥{{price}}</span> 
					<span class="sku-stock">库存
						<span class="stock">{{inventory}}</span>件
					</span>
				</span>
				<span class="sku-title-addon">请选择尺码</span>
			</div> 
			<span class="close">╳</span>
		</script>
		<script type="text/javascript">
			//获取url参数
		    function GetRequest() {
	        var url = location.search; //获取url中"?"符后的字串
	        var theRequest = new Object();
	        if (url.indexOf("?") != -1) {
	            var str = url.substr(1);
	            strs = str.split("&");
	            for (var i = 0; i < strs.length; i++) {
	                theRequest[strs[i].split("=")[0]] = (strs[i].split("=")[1]);
	            }
	        }
	        return theRequest;
		    }
		    var id = GetRequest().id;
		    $.getJSON("/api/singleGoods/",{_id: id},function (result) {
				if (result.status) {
					console.log(result)
					var html = template("tmpl-slideImgs", result);
        	var detailsHtml = template("tmlp-details", result.data);
        	var store_info = template("store_info", result.data);
        	var detailsImgs = template("detailsImgs", result.data);
        	var buy_info = template("buy_info", result.data);
        	$("#slideImgs").html(html);
        	$(".primary-info").html(detailsHtml);
        	$("#collect").html(store_info);
        	$(".pic-list").html(detailsImgs);
        	$(".sku-title").html(buy_info);
        	
        	var swiper = new Swiper('.swiper-container', {
						roundLengths : true, 
						slidesPerView: 'auto',
						centeredSlides: false,
						pagination: '.swiper-pagination', 
						paginationType: 'fraction',
						setWrapperSize :true
					});
				}
			})
		   	var Gid = sessionStorage.uid;
		   	$.getJSON("/api/getQuery",{goodsId:id},function (result) {
		   		if (result.data.length==0) {
		   			$("#foot_fav").children('.icon').css("background-position","0 0");
				}
				if (result.data.length!=0) {
					if ($("#foot_fav").hasClass("footer-fav")) {
						$("#foot_fav").children('.icon').css("background-position","0 -1.06rem");
		   			}
				}
		   	})
		   	function goodsCollect() {
				$.getJSON("/api/getQuery",{goodsId:id},function (result) {
					if (result.data.length==0) {
						$.getJSON("/api/goodsCollect/",{account:Gid},function (result) {
							if (result.status) {
								// return false 
								var accountId = result.data 
								$.post("/api/collect/insert",{accountId:accountId,goodsId:id},function(result) {
									if (result.status) {
										if ($("#foot_fav").hasClass("footer-fav")) {
											$("#foot_fav").addClass("footer-faved").removeClass("footer-fav")
											$("#foot_fav").children('.icon').css("background-position","0 -1.06rem");
											$(".ui-tips-text").text("收藏成功");
											$("#M_Tips").addClass("ui-tips-off").removeClass("ui-tips");
											$(".ui-tips-off").fadeIn(1000,function () {
												$(".ui-tips-off").fadeOut(800)
											})
										}
									}
								}) 
							} 
						})
					}
					if (result.data.length!=0){
						$.post("/api/removeCollect/",{goodsId:id},function (result) {
							if (result.status) {
								$("#foot_fav").children('.icon').css("background-position","0 0");
								$(".ui-tips-text").text("取消收藏成功");			
								$("#foot_fav").addClass("footer-fav").removeClass("footer-faved");
								$("#M_Tips").addClass("ui-tips").removeClass("ui-tips-off");
								$(".ui-tips").fadeIn(1000,function () {
									$(".ui-tips").fadeOut(800)
								})
							}
						})
					}
				})
			}
			$("#foot_fav").click(function () {
				goodsCollect();
			})
			$("#collect").on("click",".shop-collect",function () {
				goodsCollect();
			})
			//商品id和数量的获取
			$('#mid').val(id);
			$('.sku-counter').on("click",".num-add",function () {
				$('.num-input').text(parseInt($('.num-input').text())+1)
			})
			$('.sku-counter').on("click",".num-disable",function () {
				$('.num-input').text(parseInt($('.num-input').text())-1)
				if ($('.num-input').text()<1) {
					$('.num-input').text(1)
				}
			})
			$('.action').on('click','span',function () {
				$("#sales").val(parseInt($(".num-input").text()))
				var nums = parseInt($("#sales").val());
				if ($(".action span").hasClass('sure') && $('.size-list>li').hasClass('c')) {
					$.getJSON("/api/goodsCollect/",{account:Gid},function (result) {
						if (result.status) {
							var accountId = result.data._id
							$.getJSON("/api/singleGoods/",{_id: id},function (result) {
								if (result.status) {
									var price = result.data.price
									$("#total").val(nums*price)
									var total = $("#total").val();
									$.getJSON("/api/trolley/goodsList",{accountId:accountId,goodsId:id},function (result) {
										if(result.data==null){
											$.post("/api/trolley/insert",{accountId:accountId,goodsId:id,sales:nums,total:total},function (result) {
												if (result.status) {
													console.log(result.msg)
												}
											})	
										}
										if(result.data!=null){
											var newNums = parseInt(result.data.sales) + parseInt(nums)
											$.post("/api/addTrolley/",{accountId:accountId,goodsId:id,sales:newNums,total:total},function (result) {
												if (result.status) {
													console.log(result.msg)
												}
											})
										}
									})
								}
							})	
						}
					})
					alert('添加购物车成功')
					$('.goods-sku').hide()
					$('.cons-bg').hide()
				}else if ($(".action span").hasClass('confirm') && $('.size-list>li').hasClass('c')) {
					$.getJSON("/api/goodsCollect/",{account:Gid},function (result) {
						if (result.status) {
							var accountId = result.data._id
							$.getJSON("/api/singleGoods/",{_id: id},function (result) {
								if (result.status) {
									//商品计价
									var price = result.data.price
									$("#total").val(nums*price)
									var total = $("#total").val();
									console.log(total)
									$.post("/api/orderList",{accountId:accountId,goodsId:id,sales:nums,allTotal:total},function (result) {
										if(result.status){
											console.log(result.msg)
											$('.goods-sku').hide()
											$('.cons-bg').hide()
											sessionStorage.oid = result.data._id
											location.href = 'order1.html';
										}
									})
								}
							})	
						}
					})
				}else{
					alert('请选择尺码')
				}
			})
			$.getJSON("/api/goodsCollect/",{account:Gid},function (result) {
				if (result.status) {
					var id = result.data
					$.getJSON("/api/goods/findNums",{accountId:id},function (result) {
						if (result.status) {
							var trolleyLength = result.data.length
							parseInt($("#cart-num").text(trolleyLength))
						}
					})
				}
			})
		</script>
	</body>
</html>